﻿function SignInView(context) {

    var self = this;

    var email = ko.observable(context.userEmail());
    
    function submit() {
        var val = email().trim();
        window.localStorage.setItem('account', val);
        context.userEmail(val);
        window.location.hash = '#';
    }

    function signout() {
        email('');
        window.localStorage.setItem('account', '');
        context.userEmail('');
        window.location.hash = '#';
    }
    
    self.submit = submit;
    self.signout = signout;
    self.email = email;
    self.currentUser = context.userEmail;
}